package com.imooc.food.dao;

import com.imooc.food.entity.OrderDetailPO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 * ProjectName food
 *
 * @author xieyucan
 * <br>CreateDate 2022/9/22 17:55
 */
@Mapper
@Repository
public interface OrderDetailDao {

    @Insert("insert into order_detail (status,address,account_id,product_id,deliveryman_id,settlement_id,reward_id,price,date) values(#{status},#{address},#{accountId},#{productId},#{deliverymanId},#{settlementId},#{rewardId},#{price},#{date})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    void insert(OrderDetailPO orderDetailPO);


    @Update("update order_detail set status=#{status},address=#{address},account_id=#{accountId},product_id=#{productId},deliveryman_id=#{deliverymanId},settlement_id=#{settlementId},reward_id=#{rewardId},price=#{price},date=#{date} where id=#{id}")
    void update(OrderDetailPO orderDetailPO);


    @Select("select id,address,status,account_id accountId,product_id productId,deliveryman_id deliverymanId,settlement_id settlementId,settlement_id settlementIdm,reward_id rewardId,price,date from order_detail where id=#{id}")
    OrderDetailPO selectOrder(Integer id);
}
